package com.bilibili.juc.syncup;

import jdk.internal.org.objectweb.asm.tree.TryCatchBlockNode;
import org.openjdk.jol.info.ClassLayout;

import java.util.concurrent.TimeUnit;

/**
 * @author zuife
 * @description
 * @since 2024-05-14 21:18:15
 */
public class SynchronizedUpDemo1 {
    public static void main(String[] args) {
        try {
            TimeUnit.SECONDS.sleep(5);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        Object o = new Object();
        System.out.println("本应是偏向锁");
        System.out.println(ClassLayout.parseInstance(o).toPrintable());
        o.hashCode();
        synchronized (o){
            System.out.println("本应是轻量级锁");
            System.out.println(ClassLayout.parseInstance(o).toPrintable());
        }
    }
}
